package cn.hsw.component.core.exception;

import cn.hsw.component.core.enums.HttpEnum;

/**
 * 内部api调用失败异常
 * @author 李子木
 * @date 2020-11-10
 */
public class ApiException extends RuntimeException {

    private static final long serialVersionUID = 7479935208136451091L;
    private int code;

    public ApiException(){
        super(HttpEnum.RPC_API_ERROR.getMsg());
        this.code = this.code = HttpEnum.RPC_API_ERROR.getCode();
    }

    public ApiException(String message) {
        super(HttpEnum.RPC_API_ERROR.getMsg()+","+message);
        this.code = HttpEnum.RPC_API_ERROR.getCode();
    }

    public ApiException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode(){
        return this.code;
    }
}
